import java.nio.charset.CoderMalfunctionError;
import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * Date: 2024-01-28
 * Time:9:39
 */
public class Test {
    public static void main1(String[] args) throws CloneNotSupportedException {
        int a = 10;
        if (a == 10) {
            throw new CloneNotSupportedException("666");
        }
    }

    public static void main2(String[] args) {
//        String str1 = "he llo w or ld";
//        String[] s1 = str1.split(" ");
//        System.out.println(Arrays.toString(s1));
//
//        String str2 = "hello world hello";
//        String[] s2 = str2.split(" ",2); //根据空格分割为两组
//        System.out.println(Arrays.toString(s2));

//        String str2 = "hello*world*hello";
//        String[] s2 = str2.split("\\*"); //根据空格分割为两组
//        System.out.println(Arrays.toString(s2));

//        String str3 = "hello\\world\\hello";
//        String[] s3 = str3.split("\\\\");
//        System.out.println(Arrays.toString(s3));

//        String str4 = "Tomorrow+is.another day";
//        String[] s4 = str4.split("[+. ]");
//        System.out.println(Arrays.toString(s4));
//        String[] s1 = str4.split("\\+");
//        for (String s:s1) {
//
//        }
//    }
//        String str4 = "apple,banana;grape;strawberry,pear,lemon";
//        String[] s1 = str4.split(",");  //第一次分割
//        for (String s:s1) {
//            String[] tmp  = s.split(";");
//            for(int i = 0;i < tmp.length;i++) {
//                System.out.print(tmp[i] + " ");
//            }
//        }
//    }
    }

    public static void main3(String[] args) {
        String str = "   hello   world   \n" ;
        String str1 = str.trim();
        System.out.print(str);
        System.out.print(str1);
    }

    public static void main4(String[] args) {
        String s = "hello";
        s += " world";
        System.out.println(s); // 输出：hello world
        String s1 = "world";
        s1 = s;
        System.out.println(s1);
    }

    public static void main5(String[] args) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("hello");
        stringBuilder.append("abcd");
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("abc");
    }

}
